package com.epfresh.api.global;


import com.epfresh.api.utils.T;

import com.epfresh.supplier.entity.CertInfo;
import com.epfresh.supplier.entity.Goods;
import com.epfresh.supplier.entity.ProductAddEntity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @date create 17-4-5
 * @author wangzhanghuan
 * @Description
 * @version 1.0
 */
public class DataManager {



    private static DataManager instance;

    private ProductAddEntity productAddEntity;
    private CertInfo certInfo;

    public Map<String, List<T>> map = new HashMap<>();

    public Map<String ,Goods> mapPriceGoods = new HashMap<>();

    public static DataManager getInstance() {
        if (instance == null) {
            synchronized (DataManager.class) {
                if (instance == null) {
                    instance = new DataManager();
                }
            }
        }
        return instance;
    }

    public ProductAddEntity getProductAddEntity() {
        return productAddEntity;
    }

    public void setProductAddEntity(ProductAddEntity productAddEntity) {
        this.productAddEntity = productAddEntity;
    }

    public CertInfo getCertInfo() {
        return certInfo;
    }

    public void setCertInfo(CertInfo certInfo) {
        this.certInfo = certInfo;
    }


    public void putPriceGoods(String key,Goods goods){
        mapPriceGoods.put(key, goods);
    }
    public Goods getPriceGoods(String key){
       return mapPriceGoods.get(key);
    }

    public void removePriceGoods(String key){
        mapPriceGoods.remove(key);
    }

    public List<Goods> getPriceGoods(){
        List<Goods> list = new ArrayList<>();
        for (String key : mapPriceGoods.keySet()) {
           list.add(mapPriceGoods.get(key));
        }
        return list;
    }

    public void clearPriceGoods(){
        mapPriceGoods.clear();
    }


    public boolean isNoRefreshSell;

    public boolean isSellPage;
}
